<script setup lang="ts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'

const orderNo = ref<string>('')
const type = ref<string>('')
const toHome = () => {
  uni.reLaunch({
    url: '/pages/index/index'
  })
}
const toOrderDetail = () => {
  if (type.value === 'goods') {
    uni.reLaunch({
      url: '/pages/order/detail?orderNo=' + orderNo.value
    })
  } else {
    uni.reLaunch({
      url: '/pages/express/detailMe?orderNo=' + orderNo.value
    })
  }
}
onLoad((options: any) => {
  orderNo.value = options.orderNo
  type.value = options.type
}) 
</script>

<template>
  <view class="pay-res">
    <uv-icon name="checkmark-circle-fill" color="#3c9cff" size="200rpx"></uv-icon>
    <uv-text text="支付完成" size="30rpx" :bold="true"></uv-text>
    <view class="pay-res-home">
      <uv-button type="primary" @click="toHome">回到首页</uv-button>
    </view>
    <view class="pay-res-order">
      <uv-button type="primary" @click="toOrderDetail">查看订单</uv-button>
    </view>
  </view>
</template>

<style lang="scss" scoped>
::v-deep uni-page-wrapper {
  background-color: #fff;
}

.pay-res {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 50%;

  ::v-deep .uv-text {
    justify-content: center !important;
  }

  .pay-res-home {
    margin-top: 80rpx;
    margin-bottom: 20rpx;
  }

  .pay-res-home,
  .pay-res-order {
    width: 70% !important;
  }

}
</style>
